﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Sample.Bmf.Calendario.Calendario;
using Sinacor.Infra.ServiceAccess;
using System.Threading;
using Sample.Bmf.Ordens.Ordem;
using System.ServiceModel;

namespace Sample.WinForms
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            dataGridView1.DataSource = null;
            List<DateTime> datas;

            AuthenticationParm parm = new AuthenticationParm();
            parm.LoginName = "BMF03";
            parm.Password = "BMF03XX";
            parm.CompanyId = 21;

            using (ServiceClient<ICalendario> sc =
                new ServiceClient<ICalendario>(parm, "Tcp.Bmf.Calendario.Calendario.ICalendario",
                                                @"C:\Sinacor\Mais\Projetos\MAIN\Source\Infra_2.0_desenv\SDK\Sample.WinForms\bin\Endpoints\Bmf.Calendario.config"))
            {

                ICalendario calendario = sc.CreateProxy();
                datas = calendario.ConsultarDatasPregoes();
            }
            dataGridView1.DataSource = datas;

        }

        private void button3_Click(object sender, EventArgs e)
        {
            dataGridView3.DataSource = null;
            List<ConsultarNetGeralClienteResponse> ordens = null;

            //parâmetros de autenticação
            AuthenticationParm parm = new AuthenticationParm();
            parm.LoginName = "BMF03";
            parm.Password = "BMF03XX";
            parm.CompanyId = 21;

            using (ServiceClient<IOrdem> sc = new ServiceClient<IOrdem>(parm,
                "Tcp.Bmf.Ordens.Ordem.IOrdem",
                @"C:\Sinacor\Mais\Projetos\MAIN\Source\Infra_2.0_desenv\SDK\Sample.WinForms\bin\Endpoints\Bmf.Ordens.config"))
            {
                IOrdem ordem = sc.CreateProxy();

                ConsultarNetGeralClienteRequest request = new ConsultarNetGeralClienteRequest();

                ordens = ordem.ConsultarOrdensNetGeralCliente(request);
            }
            dataGridView3.DataSource = ordens;
        }

    }
}
